package cn.com.wxd.action.admin.website;

import cn.com.wxd.action.ValidatorResult;
import cn.com.wxd.entity.website.ArticleInfo;
import cn.com.wxd.common.CharUtil;

/**
 * Title:
 * Description:
 * <p>
 * Company: Amumu管理平台
 * Copyright: Copyright (c) 2017
 * All right reserved.
 * Created by WangXuDong on 2017/6/15.
 *
 * @author WangXuDong
 * @version 1.0
 */
class ArticleCtlValidator extends ValidatorResult {

    /**
     * 验证文章保存时的数据
     * @param articleInfo
     * @return
     */
    static ValidatorResult validatorSaveArticle(ArticleInfo articleInfo){
        if(CharUtil.isEmpty(articleInfo.getTitle())){
            return failuerValidatorResult("文章标题不能为空");
        }else if(articleInfo.getTitle().length()>=100){
            return failuerValidatorResult("文章标题字数不能大于100");
        }
        return successValidatorResult();
    }
}
